package com.edu.admin.controller;


import java.util.List;

//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.edu.admin.service.DistrictService;
import com.edu.admin.common.RestResult;
import com.edu.admin.vo.DistrictVo;

/**
 * 地区管理
 *  
 * @author Wangjiong
 * 
 */
@RestController
@RequestMapping(value = "/district", name = "地区管理")
public class DistrictController {
	//private static final Logger log = LoggerFactory.getLogger(DistrictController.class);
	@Autowired
	private DistrictService	districtService;
	
	/**
	 *
	 * @apiGroup district
	 * @api {get} /district/list  获取地区列表
	 * @apiVersion 1.0.0
	 * @apiName getDistrictList
	 *
	 * @apiParam {String} parentcode 父节点code
	 *
	 * @apiSuccessExample Success-Response:
	 * HTTP/1.1 200
		{
		    "code": 200,
		    "msg": "success",
		    "data": [
		        {
		            "code": "110000",
		            "name": "北京市",
		            "level": 1,
		            "parentcode": "0"
		        },
		        {
		            "code": "120000",
		            "name": "天津市",
		            "level": 1,
		            "parentcode": "0"
		        },
		        {
		            "code": "130000",
		            "name": "河北省",
		            "level": 1,
		            "parentcode": "0"
		        }
		    ]
		}
	 *
	 *
	 */
    @RequestMapping(value = "list", name = "地区列表", method = RequestMethod.GET)
    public RestResult getDistrictList(String parentcode) throws Exception {

        List<DistrictVo> districtList = districtService.getDistrictList(parentcode);
        return RestResult.ok(districtList);
    }
    



}
